
import xml.etree.ElementTree as ET
import re
#  https://blog.csdn.net/qq_37879432/article/details/78815946
#  xml.etree.ElementTree.ParseError: not well-formed (invalid token): bad xml
def get_xml_root( xml_filepath ):
    tree = ET.parse( xml_filepath )
    root = tree.getroot()
    return root
    # text=open(xml_filepath).read()
    # text=re.sub(u"[\x00-\x08\x0b-\x0c\x0e-\x1f]+",u"",text)
    # root=ET.fromstring(text)
    # return root


def get_xml_ele_text( xml_root, ele_tag_name ):
    xml_ele = xml_root.find(ele_tag_name)
    return xml_ele.text

def get_xml_ele_list( xml_root, ele_tag_name ):
    return xml_root.findall( ele_tag_name )

